package com.example.spingbootmybatis.controller;

import com.example.spingbootmybatis.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class MessageController {

    @Autowired
    UserMapper userMapper;
    @RequestMapping("/liuyan")
    public String liuyan(HttpSession session, @RequestParam("message") String message){
//        System.out.println(session.getAttribute("userwho"));
        String username = (String) session.getAttribute("userwho");
        System.out.println(message);
        userMapper.updateMessage(username,message);
        return "dashboard";
    }
}
